---
keywords:
  [
    react-native-keyboard-controller,
    KeyboardStickyView,
    keyboard sticky view,
    keyboard accessory view,
    KeyboardAccessoryView,
    keyboard sticky footer,
    sticky view,
    sticky footer,
    keyboard,
    android,
  ]
---

# KeyboardStickyView

A `KeyboardStickyView` component seamlessly ensures that a designated view sticks to the keyboard's movements, maintaining visibility and interaction. Often referred to as a **keyboard accessory** or **keyboard accessory view**, it helps you enhance the user experience by preventing important UI elements from being obscured by the keyboard, creating a smooth and user-friendly interface in your React Native application.

:::info `KeyboardAvoidingView` vs `KeyboardStickyView`
Unlike [KeyboardAvoidingView](../keyboard-avoiding-view.mdx) the `KeyboardStickyView` just moves the content along with keyboard and not resizing the inner view. Try to compare animations of `KeyboardStickyView` and `KeyboardAvoidingView` to see a difference in details on how it works and which component is suitable for your needs.
:::

import ksv from "./ksv.lottie.json";
import kav from "@site/src/components/KeyboardAvoidingViewComparison/kav-animated.lottie.json";
import ComparisonTable from "@site/src/components/ComparisonTable";
import Lottie from "@site/src/components/Lottie";

<ComparisonTable
  left={<Lottie src={ksv} />}
  right={<Lottie src={kav} />}
  leftText={
    <i>
      <code>KeyboardStickyView</code> - only footer is moving (container is not
      resized)
    </i>
  }
  rightText={
    <i>
      <code>KeyboardAvoidingView</code> - entire container is getting resized
    </i>
  }
/>

## Example

```tsx
const offset = { closed: 0, opened: 20 };

const StickyFooter = () => {
  return (
    <KeyboardStickyView offset={offset}>
      <Footer />
    </KeyboardStickyView>
  );
};
```

## Props

### `enabled`

A boolean prop indicating whether `KeyboardStickyView` is enabled or disabled. If disabled then view will be moved to its initial position (as keyboard would be closed) and will not react on keyboard movements. Default is `true`.

### `offset`

An object containing next properties:

- **closed** - additional offset to the view when keyboard is closed. Default value is `0`.
- **opened** - additional offset to the view when keyboard is opened. Default value is `0`.
